<%--
  Created by IntelliJ IDEA.
  User: limin
  Date: 2021/8/4
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title></title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">

    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <script src="js/provinces.js"></script>
    <script src="js/city.js"></script>
    <script src="js/jquery-3.5.1.js"></script>
    <script>
        $(function (){
            $.each(pr.head,function (k,pr){
                var str="<option id='"+pr.id+"' value='"+pr.id+"'>"+pr.text+"</option>"
                $("#provinces").append(str)
            })
        })
        $(function (){
            $("#provinces").change(function (){
                $("#cities").empty()
                $("#cities").append("<option value=''>==请选择城市==</option>")
                $.each(city.head,function (k,city){
                    if (city.pid == $("#provinces").val()){
                        var str="<option id='"+$("#provinces").id+"'>"+city.text+"</option>"
                        $("#cities").append(str)
                    }
                })
            })
        })

    </script>
</head>

<body>
<select name="provinces" id="provinces">
    <option value="">==请选择省份==</option>
</select>

<select name="cities" id="cities">
    <option value="">==请选择城市==</option>
</select>
</body>
</html>
